The best method for saving the print record is to save it as a resource in your document's resource fork. Since the print record is already pointed to by a valid handle, creating a resource is easy. Here are the steps required:
1. Save the refNum returned by CurResFile.
2. Make sure the resource fork of the document file is opened
using OpenResFile(IM I-115).
2. Now that you have a place to put the resource, you must get the
resource manager to create it for you. First, pick a type and ID
for your resource. You can use the Unique ID function(IM I-121) to
generate the ID. Next, call the AddResource procedure(IM I-124).
This procedure takes four parameters:
Parameter Type What to Pass
--------- ---- ------------
theData Handle The handle to the currently valid print
record.
theType ResType The four character resource type you
have chosen.
theID INTEGER The ID returned from the UniqueID
function.
name Str255 The name for this resource. This is
optional, use '' if you have no name.
3. Next call WriteResource(IM I-125), and UpdateResFile(IM I-125) to
make sure the new resource gets saved into the file.
4. Reset the currently selected file back to whatever it was before
you began the save using UseResFile(IM I-117).
The important things to keep in mind when doing this are:
1. You should make your resource type something different than those
used by the Print Manager. This will prevent the Print Manager
from getting confused and grabbing the wrong resource. Types to
avoid include; 'PREC', 'PDEF', and 'POST'.
2. Don't make any assumptions about the size of the print record. If
you really need to know the size, use GetHandleSize. This way, if
the record gets bigger in the future, your code will still work.
3. Make sure to pass the record that you get from your document to
PrValidate before using it. This will make sure that it get's
updated if any changes are made to the structure or contents of the